

'''
    需求：用户名、密码进行变量抽离

'''


# 请求接口获取响应数据
print(1)
import requests
import hashlib


username= 'kkk189'

req= requests.post(url='http://101.42.247.45:8080/register/',
                  data='{"username":"%s","password":"12345678abc","email":"wxh@qq.com"}' %(username,))

print(9,req.text)


m5= hashlib.md5()
m5.update('12345678abc'.encode('utf-8'))
pwd= m5.hexdigest()
print(pwd)


req= requests.post(url='http://101.42.247.45:8080/register/',
                  data='{"username":"%s","password":"%s","email":"wxh@qq.com"}' %(username,pwd,))

#接口响应的字符串内容
print(11,req.text)
#http协议状态码
print(2,req.status_code)

print(req.json())#dict类型
print(type(req.json()))#dict类型
print(req.json()['code'])